<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core">
    <h:head>
        <title>Plan angazovanja</title>
        <h:outputStylesheet library="css" name="styles.css"/> 
    </h:head>
    <h:body>
        <ui:include src="adminMenuBar.xhtml"/>
        <h:form>
            <p:panel header="Planovi angazovanja" styleClass="headerPanel">

                <p:fieldset legend="Dodaj plan" toggleable="true" toggleSpeed="500" collapsed="true">
                    <h:panelGrid columns="2">
                        <p:outputLabel value="Profesor:"/>
                        <p:selectOneMenu value="#{adminBean.selectedProf}" var="p" converter="profConverter">
                            <f:selectItems value="#{adminBean.profList}" var="prof" itemLabel="#{prof.ime} #{prof.prezime}" itemValue="#{prof}"/>
                            <p:column>
                                #{p.ime} #{p.prezime}
                            </p:column>
                        </p:selectOneMenu>
                        <p:outputLabel value="Student:"/>
                        <p:selectOneMenu id="nekidjavo" value="#{adminBean.selectedP}" var="p" converter="courseConverter">
                            <f:selectItems value="#{adminBean.PList}" var="predmet" itemLabel="#{predmet.naziv} - #{predmet.sifra}" itemValue="#{predmet}"/>
                            <p:column>
                                #{p.naziv} - #{p.sifra}
                            </p:column>
                        </p:selectOneMenu>
                        <p:outputLabel value="Grupa:"/>
                        <p:inputText value="#{adminBean.group}"/>

                        <p:outputLabel value=""/>
                        <p:commandButton value="Dodaj" action="#{adminBean.addPlan()}" ajax="false"/>
                    </h:panelGrid>
                </p:fieldset>
                <p:dataTable value="#{adminBean.planList}" var="p">
                    <p:column headerText="Proesor" >
                        <h:outputLabel value="#{p.zaposleni.ime} #{p.zaposleni.prezime}"/>
                    </p:column>
                    <p:column headerText="Predmet" >
                        <h:outputLabel value="#{p.predmet.naziv}"/>
                    </p:column>
                    <p:column headerText="Grupa" >
                        <h:outputLabel value="#{p.grupa}"/>
                    </p:column>
                </p:dataTable>
            </p:panel>
        </h:form>
    </h:body>
</html>
